<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
Class Mecounpon extends MY_Model
{
    public function __construct()
    {
        parent::__construct();
    }
    
    public function dbindex()
    {
        return $this->renderQrCode('5GT5FC');
    }
    
    public function getEcouponDB()
    {
        
    }
    
    private function renderQrCode($data)
    {
        $this->load->library('ciqrcode');

        $time_folder = date('Ym');
        $path_mk = 'data/images/qrcode/'.$time_folder;
        @mkdir(PROJECT_PATH.'/'.$path_mk, 0777);
        $file = 'images/qrcode/'.$time_folder.'/'.time().'.png';
        $params['data'] = $data;
        $params['level'] = 'H';
        $params['size'] = 30;
        $params['savename'] = PROJECT_PATH.'/data/'.$file;
        $this->ciqrcode->generate($params);
        return $file;
    }
    
}
